<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加用户</title>
<link href="/res/css/style.css" rel="stylesheet" type="text/css" />
<link href="/res/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/res/js/jquery.js"></script>
<script type="text/javascript" src="/res/js/select-ui.min.js"></script>
<script type="text/javascript" src="/res/js/lib/formvalid/FormValid.js"></script>
<link href="/res/js/lib/layer/skin/layer.css" rel="stylesheet" type="text/css" />
<link href="/res/js/lib/layer/skin/layer.ext.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/res/js/lib/layer/layer.js"></script>
<script type="text/javascript" src="/res/js/common/msgTools.js"></script>
<script type="text/javascript" src="/res/js/pages/goods/goodsAdd.js"></script>
<link rel="stylesheet" href="/res/js/lib/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/res/js/lib/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="/res/js/lib/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/res/js/lib/kindeditor/lang/zh-CN.js"></script>
<script charset="utf-8" src="/res/js/lib/kindeditor/plugins/code/prettify.js"></script>

<script type="text/javascript">
	$(document).ready(function(e) {
		$("select").uedSelect({});	
	});
    var editor=null;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="description"]', {
			cssPath : '/res/js/lib/kindeditor/plugins/code/prettify.css',
			uploadJson : '/res/js/lib/kindeditor/jsp/upload_json.jsp',
			fileManagerJson : '/res/js/lib/kindeditor/jsp/file_manager_json.jsp',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['queryForm'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['queryForm'].submit();
				});
			},
		   afterChange : function(){
			   this.sync();			   
		   }
		   });
		prettyPrint();
	});	
</script>
</head>

<body style="overflow-x:hidden;">
	<div class="formbody">
		<form action="/goods/add/save" method="post" enctype="multipart/form-data" onsubmit="return checkData(this)">
			<div id="tab1" class="tabson">
				<ul class="forminfo">
					<li><label>商品名称<b>*</b></label> <input name="name" value="${goods.name}" valid="required|limit" type="text" class="dfinput" style="width:150px;" />
					    <span id="errMsg_name" class="errMsg">*长度在100字以内</span>
					</li>
					<li><label>价格<b></b></label> <input name="price" value="${goods.price}" valid="isNumber"  max="20" type="text" class="dfinput" style="width:150px;" />
					    <span id="errMsg_price" class="errMsg">*</span>
					</li>
					<li><label>库存数量</label> <input id="txtPName" name="amount" value="${goods.amount}" valid="isNumber" type="text" class="dfinput" style="width:150px;" ></input>					    
					    <span id="errMsg_amount" class="errMsg">整数</span>
					</li>
					<li><label>供货商家<b></b></label> <input name="merchantName" value="${goods.merchantName}" type="text" class="dfinput" style="width:150px;" />
					    <img id="imgValid" src="" alt="" class="hide"/>
					    <span id="errMsg_merchant" class="errMsg"></span>					
					</li>					
					<li><label>是否上架<b></b></label>
						<label>有效<input type="radio" name="inStore" value="1" ${goods.inStore==1?"checked":""}/></label>
						<label>无效<input type="radio" name="inStore" value="0" ${goods.inStore==1?"":"checked"}/></label>					
					</li>
					<li><label>大图</label>
					    <input type="file" name="upimg" class="dfinput" style="width:350px;"/><br/>
					</li>
					<li>    
					    <c:if test="${!empty(goods.imgBig)}">
					    <label>&nbsp;</label><img src="${goods.imgBig}" width="360" height="198"/>
					    </c:if>
					</li>
					<li><label>小图</label>
					    <input type="file" name="upimg2" class="dfinput" style="width:350px;"/><br/>
					</li>					
					<li>    
					    <c:if test="${!empty(goods.imgSmall)}">
					    <label>&nbsp;</label><img src="${goods.imgSmall}" width="360" height="198"/>
					    </c:if>
					</li>	
					<li><label>描述<b></b></label></li>
					<li>
						<div style="clear:both;"></div>					    
					    <textarea name="description" style="width:800px;height:300px;">${goods.description}</textarea>
					    <div style="clear:both;"></div>						   	
					</li>				 					
					<li><label>&nbsp;</label> <input type="submit" class="btn" value="保 存" /></li>
				</ul>
			</div>
		</form>
	</div>
	${actionMsg}

</body>

</html>


